using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("FeedBack", "", "Wicresoft.Messages.ConnectionString")]
    public class FeedBack : Info
    {
        #region SQL column name consts
        public const string SQLCOL_FEEDBACKID = "FeedBackID";
        public const string SQLCOL_MESSAGEID = "MessageID";
        public const string SQLCOL_DEVICEID = "DeviceID";
        public const string SQLCOL_POOLID = "PoolID";
        public const string SQLCOL_POOLPARAMETER = "PoolParameter";
        public const string SQLCOL_OPTIONID = "OptionID";
        public const string SQLCOL_FEEDBACKSTATUS = "FeedBackStatus";
        public const string SQLCOL_LASTOPERATIONTIME = "LastOperationTime";
        public const string SQLCOL_RECEIVETIME = "ReceiveTime";
        public const string SQLCOL_SENDERCONTACT = "SenderContact";
        public const string SQLCOL_SENDERNAME = "SenderName";
        public const string SQLCOL_SENDERDISPLAYNAME = "SenderDisplayName";
        public const string SQLCOL_TEXT = "Text";
        public const string SQLCOL_OUTERPK = "OuterPK";
        public const string SQLCOL_USERNAME = "UserName";
        public const string SQLCOL_STATE = "State";
        public const string SQLCOL_PROCESSSTATUS = "ProcessStatus";
        public const string SQLCOL_PROCESSTIME = "ProcessTime";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public FeedBack() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public FeedBack(Guid FeedBackID)
        {
            this.FeedBackID = FeedBackID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            FeedBackID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_FEEDBACKID]);
            MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
            DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
            PoolID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_POOLID]);
            PoolParameter = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_POOLPARAMETER]);
            OptionID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_OPTIONID]);
            FeedBackStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_FEEDBACKSTATUS]);
            LastOperationTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_LASTOPERATIONTIME]);
            ReceiveTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_RECEIVETIME]);
            SenderContact = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERCONTACT]);
            SenderName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERNAME]);
            SenderDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERDISPLAYNAME]);
            Text = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEXT]);
            OuterPK = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_OUTERPK]);
            UserName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_USERNAME]);
            State = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_STATE]);
            ProcessStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSSTATUS]);
            ProcessTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_PROCESSTIME]);
        }

        #region Properties
        #region Property <Guid> FeedBackID
        [Property("FeedBackID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid FeedBackID
        {
            get { return _FeedBackID; }
            set { _FeedBackID = value; }
        }
        private Guid _FeedBackID = Guid.Empty;
        #endregion

        #region Property <Guid> MessageID
        [Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid MessageID
        {
            get { return _MessageID; }
            set { _MessageID = value; }
        }
        private Guid _MessageID = Guid.Empty;
        #endregion

        #region Property <int> DeviceID
        [Property("DeviceID", 4, SqlDbType.Int, false, false)]
        public int DeviceID
        {
            get { return _DeviceID; }
            set { _DeviceID = value; }
        }
        private int _DeviceID = int.MinValue;
        #endregion

        #region Property <Guid> PoolID
        [Property("PoolID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid PoolID
        {
            get { return _PoolID; }
            set { _PoolID = value; }
        }
        private Guid _PoolID = Guid.Empty;
        #endregion

        #region Property <string> PoolParameter
        [Property("PoolParameter", 200, SqlDbType.NVarChar, false, false)]
        public string PoolParameter
        {
            get { return _PoolParameter; }
            set { _PoolParameter = value; }
        }
        private string _PoolParameter = null;
        #endregion

        #region Property <Guid> OptionID
        [Property("OptionID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid OptionID
        {
            get { return _OptionID; }
            set { _OptionID = value; }
        }
        private Guid _OptionID = Guid.Empty;
        #endregion

        #region Property <int> FeedBackStatus
        [Property("FeedBackStatus", 4, SqlDbType.Int, false, false)]
        public int FeedBackStatus
        {
            get { return _FeedBackStatus; }
            set { _FeedBackStatus = value; }
        }
        private int _FeedBackStatus = int.MinValue;
        #endregion

        #region Property <DateTime> LastOperationTime
        [Property("LastOperationTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime LastOperationTime
        {
            get { return _LastOperationTime; }
            set { _LastOperationTime = value; }
        }
        private DateTime _LastOperationTime = DateTime.MinValue;
        #endregion

        #region Property <DateTime> ReceiveTime
        [Property("ReceiveTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime ReceiveTime
        {
            get { return _ReceiveTime; }
            set { _ReceiveTime = value; }
        }
        private DateTime _ReceiveTime = DateTime.MinValue;
        #endregion

        #region Property <string> SenderContact
        [Property("SenderContact", 200, SqlDbType.NVarChar, false, false)]
        public string SenderContact
        {
            get { return _SenderContact; }
            set { _SenderContact = value; }
        }
        private string _SenderContact = null;
        #endregion

        #region Property <string> SenderName
        [Property("SenderName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderName
        {
            get { return _SenderName; }
            set { _SenderName = value; }
        }
        private string _SenderName = null;
        #endregion

        #region Property <string> SenderDisplayName
        [Property("SenderDisplayName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderDisplayName
        {
            get { return _SenderDisplayName; }
            set { _SenderDisplayName = value; }
        }
        private string _SenderDisplayName = null;
        #endregion

        #region Property <string> Text
        [Property("Text", 2147483646, SqlDbType.NText, false, false)]
        public string Text
        {
            get { return _Text; }
            set { _Text = value; }
        }
        private string _Text = null;
        #endregion

        #region Property <string> OuterPK
        [Property("OuterPK", 100, SqlDbType.NVarChar, false, false)]
        public string OuterPK
        {
            get { return _OuterPK; }
            set { _OuterPK = value; }
        }
        private string _OuterPK = null;
        #endregion

        #region Property <string> UserName
        [Property("UserName", 100, SqlDbType.NVarChar, false, false)]
        public string UserName
        {
            get { return _UserName; }
            set { _UserName = value; }
        }
        private string _UserName = null;
        #endregion

        #region Property <int> State
        [Property("State", 4, SqlDbType.Int, false, false)]
        public int State
        {
            get { return _State; }
            set { _State = value; }
        }
        private int _State = int.MinValue;
        #endregion

        #region Property <int> ProcessStatus
        [Property("ProcessStatus", 4, SqlDbType.Int, false, false)]
        public int ProcessStatus
        {
            get { return _ProcessStatus; }
            set { _ProcessStatus = value; }
        }
        private int _ProcessStatus = int.MinValue;
        #endregion

        #region Property <DateTime> ProcessTime
        [Property("ProcessTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime ProcessTime
        {
            get { return _ProcessTime; }
            set { _ProcessTime = value; }
        }
        private DateTime _ProcessTime = DateTime.MinValue;
        #endregion
        #endregion




    }
}
